﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Collections;

namespace LybrixNursingCRMDesktop.CustomControls
{
    /// <summary>
    /// Interaction logic for SearchComboField.xaml
    /// </summary>
    public partial class SearchComboField : UserControl
    {
        #region Members

        private bool isDoubleSize;

        #endregion

        #region Constructor

        public SearchComboField()
        {
            InitializeComponent();
        }

        #endregion

        #region Properties

        public string LabelContent
        {
            get { return fieldLabel.Content.ToString(); }

            set { fieldLabel.Content = value; }
        }

        public string FieldID { get; set; }

        public IEnumerable SetItemsSource
        {
            set { fieldValue.ItemsSource = value; }
        }

        public string[] SetStringItemsSource
        {
            set { fieldValue.ItemsSource = value; }
        }
        public object Value
        {
            get { return fieldValue.SelectedItem; }
        }

        public bool GotValue
        {
            get { return !(fieldValue.SelectedItem == null); }
        }

        public Boolean IsDoubleSize
        {
            get { return isDoubleSize; }
            set
            {
                isDoubleSize = value;
                if (isDoubleSize)
                    fieldValue.Width = 150;
                else
                    fieldValue.Width = 400;
            }



        }

        public void ClearValue()
        {
            fieldValue.SelectedItem = null;
        }
        public void AddDefault()
        {
            fieldValue.Items.Add("");
        }


        public void SetItem(object item)
        {
            fieldValue.SelectedItem = item;
        }


        public void DisplayMemberPath(string name)
        {
            fieldValue.DisplayMemberPath = name;
        }

       public void SelectedValuePath(string name)
        {
            fieldValue.SelectedValuePath = name;
        }
  

        #endregion
    }
}
